package com.zareal.feign;

import com.zareal.dot.PutApplicationDto;
import com.zareal.enums.GlobalErrorCode;
import com.zareal.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class PurchaseFeignClientFallbackFactory implements FallbackFactory<PurchaseFeignClient> {

    @Override
    public PurchaseFeignClient create(Throwable throwable) {
        return new PurchaseFeignClient() {
            @Override
            public JSONResult putApplication(PutApplicationDto putApplicationDto) {
                return JSONResult.error(GlobalErrorCode.PUT_APPLICATION_ERRORR.getErrorMessage());
            }
        };
    }
}
